import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    host: '0.0.0.0', // 监听所有地址
    port: 5173,
    strictPort: true, // 如果端口已被占用，则会直接退出
    cors: true, // 允许跨域
    proxy: {
      '/api': {
        target: 'http://47.96.185.70:8000',
        changeOrigin: true,
        secure: false,
        rewrite: (path) => path.replace(/^\/api/, '/api')
      }
    },
    hmr: {
      clientPort: 5173
    }
  }
})
